package app.itgungnir.compose.wan.business.coin_rank

import androidx.lifecycle.ViewModel
import androidx.paging.PagingData
import app.itgungnir.compose.wan.utils.WanPagingResponse
import app.itgungnir.compose.wan.utils.pagingSourceWithoutCache
import app.itgungnir.compose.wan.utils.wanAndroidService
import app.itgungnir.compose.wan.utils.wanResponse
import kotlinx.coroutines.flow.Flow

class CoinRankViewModel : ViewModel() {

    val dataFlow: Flow<PagingData<CoinRank>> = pagingSourceWithoutCache(firstPageIndex = 1, pageSize = 30) {
        wanAndroidService.getCoinRank(pageNo = it).wanResponse<WanPagingResponse<CoinRank>>()
    }
}
